<?php
use Illuminate\Support\Facades\Route;
use \Illuminate\Mail;

/**
 * namespace 是 控制器的命名空间
 */
Route::group(['namespace'=>'Admin'],function (){

    Route::get('login','LoginController@index')->name('admin.login');
    Route::post('login','LoginController@login')->name('admin.login');
    Route::get('logout','LoginController@logout')->name('admin.logout');
    Route::get('error','IndexController@error_403')->name('admin.403'); //403 错误页面


});


/*
 * as 路由别名
 */
Route::group(['namespace'=>'Admin','middleware'=>'login','as'=>'admin.'],function (){



    Route::get('index','IndexController@index')->name('index');

    Route::get('welcome','IndexController@welcome')->name('welcome');

    Route::get('user/index','UserController@index')->name('user.index');

    Route::get('user/add','UserController@add')->name('user.add');
    Route::post('user/add','UserController@addUp')->name('user.add');

    Route::delete('user/del','UserController@del')->name('user.del');//删除

    Route::get('user/restore','UserController@restore')->name('user.restore'); //恢复


    //资源路由新定义的方法要写在资源路由上方，要不到方法
    //角色分配权限
    Route::get('role/node/{role}','RoleController@node')->name('role.node');
    Route::post('role/node/{role}','RoleController@nodeSave')->name('role.node');


    //用户分配角色
    Route::match(['get','post'],'user/role/{user}','UserController@role')->name('user.role');

    //角色管理   资源路由
    Route::resource('role', 'RoleController');
    //节点管理 资源路由
    Route::resource('node', 'NodeController');

    Route::post('article/localUploadFile','ArticleController@localUploadFile')->name('article.localUploadFile');

    Route::get('article/export', 'ArticleController@export')->name('article.export');
    Route::resource('article', 'ArticleController');
    Route::post('fang_attr/ossUploadFile','FangAttrController@ossUploadFile')->name('fang_attr.ossUploadFile');
    Route::resource('fang_attr', 'FangAttrController');

    //房东本地上传 图片 和删除
    Route::post('owner/localUploadFile','FangOwnerController@localUploadFile')->name('owner.localUploadFile');
    Route::delete('owner/delPic','FangOwnerController@delPic')->name('owner.delPic');

    //房东云端上传 图片 和删除
    Route::post('owner/ossUploadFile','FangOwnerController@ossUploadFile')->name('owner.ossUploadFile');
    Route::delete('owner/delOssPic','FangOwnerController@ossDelPic')->name('owner.ossDelPic');

    Route::get('fang_owners/export', 'FangOwnerController@export')->name('fang_owners.export');
    Route::resource('fang_owners', 'FangOwnerController');   //房东管理系统


    //房源本地上传 图片 和删除
    Route::post('fang/localUploadFile','FangController@localUploadFile')->name('fang.localUploadFile');
    Route::delete('fang/delPic','FangController@delPic')->name('fang.delPic');
    Route::get('fang/esIndex','FangController@createFangEsIndex')->name('fang.createFangEsIndex');

    Route::put('fang/chang_status','FangController@changStatus')->name('fang.chang_status');
    Route::resource('fang', 'FangController');   //房源资源路由

    Route::get('city/change', 'CityController@getCityDataById')->name('getCityDataById'); //城市多级联动内容改变事件

    Route::resource('notice', 'NoticeController');   //预约表资源路由

    Route::resource('apiuser', 'ApiuserController');   //接口账号资源路由

    Route::get('/store_seckill/classes','StoreSeckillController@classes');
    Route::get('/store_seckill/getStoreSeckill','StoreSeckillController@getStoreSeckill');
    Route::get('/store_seckill/index','StoreSeckillController@index');
    Route::get('/store_seckill/store','StoreSeckillController@store'); //秒杀商品添加

    Route::get('getORcode','OrcodeController@getORcode');


});

